local liegong = fk.CreateSkill{
  name = "wk_heg__liegongx",
}

Fk:loadTranslationTable{
  ["wk_heg__liegongx"] = "烈攻",
  [":wk_heg__liegongx"] = "①当你受到伤害后，你可以明置一张手牌；②你的明置牌均视为无次数限制的【杀】。",
  ["#wk_heg__liegongx_filter"] = "烈攻",
  ["#wk_heg__liegongx_choose2Show"] = "烈攻：你可以明置一张手牌",
}

local H = require "packages.ol_hegemony.util"
local HG = require "packages.new_heg_diy_my.util"

liegong:addEffect(fk.Damaged, {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(self) and target == player
  end,
  on_cost = function (self, event, target, player, data)
    local card = player.room:askToCards(player, {
      min_num = 1,
      max_num = 1,
      skill_name = liegong.name,
      include_equip = false,
      prompt = "#wk_heg__liegongx_choose2Show"})
    if not card then return end
    event:setCostData(self, {card = card})
    return true
  end,
  on_use = function (self, event, target, player, data)
    HG.showCards(player, event:getCostData(self).card)
  end
})

liegong:addEffect(fk.CardUsing, {
  can_trigger = function (self, event, target, player, data)
    return data.card.skillName == liegong.name
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    data.extraUse = true
    player:addCardUseHistory(data.card.trueName, -1)
  end
})

liegong:addEffect("filter", {
  card_filter = function(self, to_select, player)
    return player:hasSkill(self) and to_select:getMark(MarkEnum.ShownCards) > 0 and
    table.contains(player.player_cards[Player.Hand], to_select.id)
  end,
  view_as = function(self, player, to_select)
    local card = Fk:cloneCard("slash", to_select.suit, to_select.number)
    card.skillName = liegong.name
    return card
  end,
})

liegong:addEffect("targetmod", {
  name = "#wk_heg__liegongx_targetmod",
  bypass_times = function (self, player, skill, scope, card, to)
    return card and table.contains(card.skillNames, liegong.name)
  end
})

return liegong